home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
.net (French) 1996 November
/
.net Magazine (FR) - Issue 01 - Nov 1996.iso
/
mac
/
Butineur
/
Netscape Plug-ins
/
KM's QuickTime plug
/
Sources
/
npapi.p
< prev
next >
Wrap
Text File
|
1996-02-04
|
6KB
|
207 lines
unit npapi;
interface
uses Quickdraw, Events, Printing;
{
npapi.p. My personal translation of Netscape's npapi.h file from the New SDK 0.7.
Interface bugs are probably mine, not Netscape's.
Kevin McMurtrie mcmurtri@wco.com
2/3/95
Original info:
npapi.h $Revision: 1.56 $
Netscape client plug-in API spec
}
{
Version constants
}
const
NP_VERSION_MAJOR = 0;
NP_VERSION_MINOR = 6;
{
Basic types
}
type
charstar = ^packed array [1..1] of char;
arglist = ^packed array [1..1] of charstar;
{
PROCEDURE C2PStrProc(aStr: UNIV Ptr);
FUNCTION C2PStr(cString: UNIV Ptr): StringPtr;
PROCEDURE P2CStrProc(aStr: StringPtr);
FUNCTION P2CStr(pString: StringPtr): Ptr;
}
NPError = integer;
NPMIMEType = charstar;
{
NPP is a plug-in's opaque instance handle
}
NPP = record {NOW VAR, NOT POINTER}
pdata: Ptr; { plug-in private data }
ndata: Ptr; { netscape private data }
end;
NPStream = record {NOW VAR, NOT POINTER}
pdata: Ptr; { plug-in private data }
ndata: Ptr; { netscape private data }
url: charstar; { CONST}
TheEnd: longint;
lastmodified: longint;
end;
NPByteRange = record
offset: longint; { negative offset means from the end }
length: longint;
next: ^NPByteRange;
end;
NPSavedData = record
len: longint;
buf: array [0..0] of SignedByte;
end;
NPSavedDataPtr = ^NPSavedData;
NP_Port = record
port: CGrafPtr; { Grafport }
portx: longint; { how far away the top window corner is from object (neg #s)}
porty: longint;
end;
NPWindow = record
window: ^NP_Port; { platform specific window handle }
x: longint; { position of top left corner relative to a netscape page }
y: longint;
width: longint; { maximum window size }
height: longint;
clipRect: Rect; { clipping rectangle in port coordinates }
end;
NPWindowPtr = ^NPWindow;
NPFullPrint = record
pluginPrinted: boolean; { Set TRUE if plugin handled fullscreen printing }
printOne: boolean; { TRUE if plugin should print one copy to default printer }
platformPrint: THPrint; { Platform-specific printing info }
end;
NPEmbedPrint = record
window: NPWindow;
platformPrint: THPrint; { Platform-specific printing info }
end;
NPPrint = record
mode: integer; { NP_FULL or NP_EMBED }
case integer of
1: (fullPrint: NPFullPrint;); { if mode is NP_FULL }
2: (embedPrint: NPEmbedPrint;); { if mode is NP_EMBED }
end;
{ Mac-specific structures and definitions.}
{
Non-standard event types that can be passed to HandleEvent
}
const
getFocusEvent = (osEvt + 16);
loseFocusEvent = (osEvt + 17);
adjustCursorEven = (osEvt + 18);
NP_EMBED = 1;
NP_FULL = 2;
NP_BACKGROUND = 3;
NP_NORMAL = 1;
NP_SEEK = 2;
NP_ASFILE = 3;
{#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) Huh?!?!?!?}
{
* Error and reason code definitions.
}
NP_NOERR = 0;
NP_EINVAL = 1;
NP_EABORT = 2;
NPERR_BASE = 0;
NPERR_NO_ERROR = (NPERR_BASE + 0);
NPERR_GENERIC_ERROR = (NPERR_BASE + 1);
NPERR_INVALID_INSTANCE_ERROR = (NPERR_BASE + 2);
NPERR_INVALID_FUNCTABLE_ERROR = (NPERR_BASE + 3);
NPERR_MODULE_LOAD_FAILED_ERROR = (NPERR_BASE + 4);
NPERR_OUT_OF_MEMORY_ERROR = (NPERR_BASE + 5);
NPERR_INVALID_PLUGIN_ERROR = (NPERR_BASE + 6);
NPERR_INVALID_PLUGIN_DIR_ERROR = (NPERR_BASE + 7);
NPERR_INCOMPATIBLE_VERSION_ERROR = (NPERR_BASE + 8);
NPRES_BASE = 0;
NPRES_NETWORK_ERR = (NPRES_BASE + 0);
NPRES_USER_BREAK = (NPRES_BASE + 1);
NPRES_DONE = (NPRES_BASE + 3);
{
Function prototypes.
Functions beginning with 'NPP' are functions provided by the plugin that Netscape will call.
Functions beginning with 'NPN' are functions provided by Netscape that the plugin will call.
}
{
NPError NPP_Initialize(void);
void NPP_Shutdown(void);
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason);
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
int16 NPP_HandleEvent(NPP instance, void* event);
void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor);
NPError NPN_GetURL(NPP instance, const char* url, const char* window);
NPError NPN_PostURL(NPP instance, const char* url, uint32 len, const char* buf, NPBool file);
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
NPError NPN_NewStream(NPP instance, NPMIMEType type, NPStream* stream);
int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer);
NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason);
void NPN_Status(NPP instance, const char* message);
const char* NPN_UserAgent(NPP instance);
void* NPN_MemAlloc(uint32 size);
void NPN_MemFree(void* ptr);
uint32 NPN_MemFlush(uint32 size);
void NPN_ReloadPlugins(NPBool reloadPages);
}
implementation
end.